import { useContext } from "react";
import { infoById } from "../mockData";
export function loadRecord(editor) {
  try {
    // editor.bsState.itemIds = 342
    // const id = editor.bsState.itemIds;
    // let editor = useContext(window.EditorContent)
    // let editor = window.EditorContent
    let { bsState, state } = editor;
    // let modelRecordId = infoById[0]?.serialNo
    // bsState.seriesFrameId = infoById[0]?.sceneId
    // let model = undefined;
    // if (modelRecordId) {
    //   model = {
    //     recordId: modelRecordId,
    //     id: '',
    //     version: '',
    //     state: '',
    //   };
    // }
    let dataInfos = []
    dataInfos = infoById.map(item => {
      return {
        // id: config.id,
        id: item.id + '',
        datasetId: item.datasetId + '',
        teamId: item.teamId + '',
        // config: [],
        // viewConfig: [],
        pointsUrl: '',
        queryTime: '',
        loadState: '',
        // model: model,
        needSave: false,
        classifications: [],
        dataStatus: 'VALID',
        annotationStatus: 'NOT_ANNOTATED',
        skipped: false,
      }
    })
    // console.log(editor, "获取初始数据");
    editor.setFrames(dataInfos);
    // editor.taskLoadFrame(0, false);
  } catch (error) {
    
  }
}